#include<stdio.h>
int fun(int year)
{
    if(year % 400 == 0 || year % 4 == 0 && year % 100 != 0) return 1;
    return 0;
}
int main()
{
    int x, y;
    scanf("%d %d", &x, &y);
    int a[1000];//注意数据范围
    int i, j;
    for(i = x, j = 0; i <= y; i ++)
        if(fun(i) == 1)
            a[j ++] = i;
    printf("%d\n", j);
    for(i = 0; i < j; i ++)
        printf("%d ", a[i]);
    return 0;
}